RIGHT$ Function ---------------------------------------------------------------------------- Action Returns a string consisting of the rightmost n% characters of a string. Syntax RIGHT$( stringexpression$, n%) Remarks The argument stringexpression$ can be any string variable, string constant, or string expression. The argument n% is a numeric expression between 0 and 32,767, inclusive, indicating how many characters are to be returned. If n% is 0, the null string (length 0) is returned. If n% is greater than or equal to the number of characters in stringexpression$, the entire string is returned. To find the number of characters in stringexpression$, use LEN( stringexpression$) . See Also LEFT$, MID$ Function Example The following example converts names entered in the form "Firstname [Middlename] Lastname" to the form "Lastname, Firstname [Middlename]." CLS' Clear screen. LINE INPUT "Name. "; Nm$ I = 1 . Sppos = 0 DO WHILE I > 0 I = INSTR(Sppos + 1, Nm$, " ")' Get position of next space. IF I > 0 THEN Sppos = I LOOP ' Sppos now points to the position of the last space. IF Sppos = 0 THEN PRINT Nm$ ' Only a last name was input. ELSE ' Everything after last space. Lastname$ = RIGHT$(Nm$, LEN(Nm$) - Sppos) ' Everything before last space. Firstname$ = LEFT$(Nm$, Sppos - 1) PRINT Lastname$ ", " Firstname$ END IF END